let form = layui.form;
form.verify({
  len: [/^\S{6,12}$/, "长度为6~12,不为空"],
  diff: function (val) {
    let opwd = $("input[name=oldPwd]").val();
    //判断
    if (opwd === val) return "和原密码一致";
  },
  same: function (val) {
    //获取密码
    let pwd = $("input[name=newPwd]").val();
    //判断
    if (pwd !== val) return "新密码不一致";
  },
});
// -------------------------------  修改密码 ---------
$("form").on("submit", function (e) {
  e.preventDefault();
  let data = $(this).serialize();
  axios.post("/my/user/updatepwd", data).then((res) => {
    let { status, message } = res.data;
    if (status === 0) {
      
      layer.msg(message);
    }
  });
});
